package com.young.quartz.domain.vo;

import lombok.Data;

import java.io.Serializable;

@Data
public class CommonResponse implements Serializable {
    private Integer code;
    private String message;
    private Object data;

    public static CommonResponse success(){
        CommonResponse commonResponse = new CommonResponse();
        commonResponse.setCode(0);
        return commonResponse;
    }

    public static CommonResponse success(Object data){
        CommonResponse commonResponse = new CommonResponse();
        commonResponse.setCode(0);
        commonResponse.setData(data);
        return commonResponse;
    }

    public static CommonResponse success(Object data,String message){
        CommonResponse commonResponse = new CommonResponse();
        commonResponse.setCode(0);
        commonResponse.setData(data);
        commonResponse.setMessage(message);
        return commonResponse;
    }


    public static CommonResponse error(){
        CommonResponse commonResponse = new CommonResponse();
        commonResponse.setCode(-1);
        return commonResponse;
    }

    public static CommonResponse error(String message){
        CommonResponse commonResponse = new CommonResponse();
        commonResponse.setCode(-1);
        commonResponse.setMessage(message);
        return commonResponse;
    }


}
